package com.qf.serviceimpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.dao.UserDao;
import com.qf.entity.User;
import com.qf.service.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author Ypl
 * @version V1.0
 * @Project September-mavens
 * @Package com.qf.serviceimpl
 * @Description:
 * @Date 2022/9/30 17:42
 */
@SuppressWarnings("all")
@org.springframework.stereotype.Service
public class ServiceImpl implements Service {

    @Autowired
    UserDao userDao;

    @Override
    public List<User> selsectAll() {
        return userDao.selectAll();
    }

    @Override
    public PageInfo<User> findByPage(Integer pageNum, Integer pageSize) {
        //开始分页
        PageHelper.startPage(pageNum,pageSize);
        //查询所有
        List<User> users = userDao.selectAll();
//        创建pageinfo对象
        PageInfo<User> info = new PageInfo<>(users);
        return info;
    }
}
